package com.rfid.base.manager;


public enum TokenManager {

    INSTANCE;

    String token;
    long lastTime;
    long expires;

    public String getToken() {
        if (System.currentTimeMillis() - lastTime > expires - 10) {
            return "";
        }
        return token;
    }

    public void setToken(String token,long timeout) {
        this.token = token;
        this.expires = timeout;
        lastTime = System.currentTimeMillis();
    }

}
